home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / wnos5src.zip / PROC.H < prev    next >
Text File  |  1993-08-09  |  2KB  |  73 lines

  1. #ifndef    _PROC_H
  2. #define    _PROC_H
  3.  
  4. #include <setjmp.h>
  5.  
  6. #ifndef _MBUF_H
  7. #include "mbuf.h"
  8. #endif
  9.  
  10. #ifndef    _TIMER_H
  11. #include "timer.h"
  12. #endif
  13.  
  14. #define    PHASH    16                /* Number of wait table hash chains */
  15.  
  16. /* Kernel process control block */
  17. struct proc {
  18.     struct proc *next;            /* linked list pointer */
  19.     jmp_buf env;                /* Process state */
  20.     int i_state;                /* Process interrupt state */
  21.     unsigned short state;
  22. #define    READY    0
  23. #define    WAITING    1
  24. #define    SUSPEND    2
  25.     void *event;                /* Wait event */
  26.     int16 *stack;                /* Process stack */
  27.     unsigned int stksize;        /* Size of same */
  28.     char name[20];                /* Arbitrary user-assigned name */
  29.     void *retval;                /* Return value from next pwait() */
  30.     struct timer alarm;            /* Alarm clock timer */
  31.     int input;                    /* standard input socket */
  32.     int output;                    /* standard output socket */
  33.     int iarg;                    /* Copy of iarg */
  34.     void *parg1;                /* Copy of parg1 */
  35.     void *parg2;                /* Copy of parg2 */
  36.     int freeargs;                /* Free args on termination if set */
  37. };
  38. #define NULLPROC (struct proc *)0
  39.  
  40. extern int Stkchk;                /* Stack checking flag */
  41.  
  42. extern struct proc *Curproc;    /* Currently running process */
  43. extern struct proc *Rdytab;        /* Head of ready list */
  44. extern struct proc *Waittab;    /* Head of wait list */
  45. extern struct proc *Susptab;    /* Suspended processes */
  46.  
  47. /* In  kernel.c: */
  48. void alert __ARGS((struct proc *pp,void *val));
  49. void chname __ARGS((struct proc *pp,char *newname));
  50. void killproc __ARGS((struct proc *pp));
  51. void killself __ARGS((void));
  52. struct proc *mainproc __ARGS((char *name));
  53. struct proc *newproc __ARGS((char *name,unsigned int stksize,
  54.     void (*pc) __ARGS((int,void *,void *)),
  55.     int iarg,void *parg1,void *parg2,int freeargs));
  56. int psignal __ARGS((void *event,int n));
  57. void *pwait __ARGS((void *event));
  58. void resume __ARGS((struct proc *pp));
  59. void semwait __ARGS((int *sema,int req));
  60. void semrel  __ARGS((int *sema));
  61. void suspend __ARGS((struct proc *pp));
  62.  
  63. /* In ksubr.c: */
  64. void chkstk __ARGS((void));
  65. void kinit __ARGS((void));
  66. void psetup __ARGS((struct proc *pp,int iarg,void *parg1,void *parg2,
  67.     void  __ARGS(((*pc) __ARGS((int,void *,void *)) )) ));
  68.  
  69. /* Stack background fill value for high water mark checking */
  70. #define    STACKPAT    0x55aa
  71.  
  72. #endif    /* _PROC_H */
  73.